Skip to content

feat(spec, platform-objects): the standard unit table and the organization unit object sys_unit (ADR-0158 U1-U3) - #35581

Merged
os-zhuang merged 8 commits into
mainfrom
claude/issue-35488-unit-tables
Nov 19, 2026
Merged

os-zhuang merged 8 commits into
mainfrom
claude/issue-35488-unit-tables

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #35488
Refs #35465
Refs #35466

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 管理员在设置的「配置」下多一个「计量单位」页,可以登记本组织自己的单位(比如编码“BOX_12”、名称“12 只装箱”),所有成员都能看到它的名称;平台同时内置一张约四十个国际标准单位的表(公斤、米、升、小时、件、箱等),目前还没有任何字段使用它们。
  • 这是“计量单位”第一期的地基,后面的数量字段声明单位、保存时校验单位、按单位显示等卡片都会用到它;同时定下了单位表收哪些单位、新对象归哪个包、以及删除后的单位编码能不能重新启用这三个待决问题。
  • 只有组织管理员能新增或修改单位,成员只能查看;单位不能真正删除,只能停用,停用后不能恢复,同一编码也不能再建一次,以免旧数据的含义被改掉;这个改动可以直接撤回,因为还没有地方读取这些数据。
  • 需要你做的:无。“停用后不能恢复、编码不能重新启用”这条规则由席位在合同评审中裁决。

席位核对 (seat check)

  • Ruled, executed as ruled. U1 closed constant, not a ValueDomainSchema member (pinned: it keeps 3 members). U2 piece H87; C62 and EA absent from the table and refused as org codes. U3 sys_unit org-owned, organization_id injected (census reach in, tenant field organization_id; the integration test reads it stamped), zero shipped rows (pinned on the manifest), org codes at least 4 characters or containing _. Members read it. L1: ratio written only by an org admin or owner, field history on every column, code and dimension refused on change. L2: one label column. U6/L4/OI10: decimal_places (0 to 12) on the row.
  • One reading the seat should confirm. L1 says "delete allowed" and OI2 says "delete: org admin"; the brief's OI11 recommendation and its example mechanism ("a soft-retire flag instead of a hard delete") are how this PR spells that delete: an org admin retires the row (retired, one way). There is no hard delete through the data API or Setup. If the seat reads L1 as requiring a physical delete, OI11 as recommended cannot hold and this needs a ruling.
  • Settled here (ADR-0158 amended, dated notes). OI1 membership: 41 codes over mass, length, area, volume, time, count and package, each ratio an exact decimal string with scale at most 12 and a named source. OI2: owner platform-objects, field list, grants. OI11: a deleted code stays retired; mechanism and pins listed in the ADR note.
  • One file beyond the first claim (amended 7015603132). packages/cli/test/connect-agent-both-halves-wire.pin.test.ts: Test Core 1/10 went red on 298bbb987 because that pin counts the Setup tree at 31, and the new nav_units_of_measure entry makes it 32. c890bf191 sets both counts to 32 and asserts the entry is present.
  • Fences held. No unitConfig, no field key, no write-path membership check, no renderer, no Units of measure R1: an organization setting for how many decimal places each standard unit displays #35498 setting.
  • Deviation from the brief's wording. The brief lists the dimension as "piece"; the table names it count (base H87, with PR and DZN as multiples), because a pair and a dozen are counts, not pieces. The reasoning is in the ADR OI1 note.

What changes

  • @objectstack/spec (@objectstack/spec/data): STANDARD_UNITS (41 UN/ECE Rec 20 codes), UNIT_DIMENSIONS, UNIT_DIMENSION_BASE_CODES (KGM, MTR, MTK, MTQ, SEC, H87), ORGANIZATION_UNIT_CODE_PATTERN; sys_unit joins PLATFORM_OBJECTS_BY_PACKAGE['platform-objects']. The api-surface and export-origins files are regenerated.
  • @objectstack/platform-objects: sys_unit (code, label, dimension, ratio scale 12, decimal_places, retired), its rules (namespace format; code, dimension and retired one way; ratio required except on package and refused on package), the org-scoped unique key on code, apiMethods get list create update bulk, Setup → Configuration → Units of Measure, and the translation bundles (zh-CN translated; the other locales take the generator's English fill).
  • @objectstack/plugin-security: member_default reads sys_unit (no create, edit or delete).
  • @objectstack/cli: the organization-ownership inventory lists sys_unit as attributed.
  • scripts/platform-object-tenancy-census.json is regenerated (104 registered, 53 in reach).

First files to read, by risk:

  1. packages/platform-objects/src/system/sys-unit.object.ts, the validations block and enable.apiMethods: these carry L1 and OI11.
  2. packages/plugins/plugin-security/src/objects/default-permission-sets.ts, the sys_unit row in member_default.
  3. packages/spec/src/data/standard-units.ts, the ratio table.

Two-minute check: pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/default-permission-sets.unit-of-measure.integration.test.ts should print 14 passed. It boots a real stack and shows a member reading but refused writes, an admin writing, refused codes, immutability refusals, and re-creating a retired code refused with 409.

Tests

All tests below ran on head 298bbb987, with the tree byte-identical to the commit.

Package suites (under the verify lock, `set -e`)
  • @objectstack/spec: src/data/standard-units.test.ts, src/data/api-methods-batch-conformance.test.ts, platform-object-names, platform-tool-names and value-domain: Test Files 5 passed (5), Tests 67 passed (67).
  • @objectstack/platform-objects full suite: Test Files 125 passed (125), Tests 2092 passed (2092).
  • @objectstack/cli unit layer, inventory tests: Test Files 1 passed (1), Tests 26 passed (26). The integration layer is left to CI because the diff does not touch it.
  • @objectstack/plugin-security full suite: Test Files 282 passed (282), Tests 7050 passed, 45 skipped (7095). This includes the new default-permission-sets.unit-of-measure.integration.test.ts (14).
  • Typecheck: spec, platform-objects and plugin-security gave VERDICT command-exit 0. cli gave VERDICT command-exit 0.

Acceptance notes

  • Engine-level delete is not refused. apiMethods closes the data API, and Setup offers no Delete, but a delete issued to the engine below the REST door is not refused. No platform path issues one, and whether an automation could is not measured. This is recorded in the ADR OI11 note.
  • bulk is granted. The apiMethods batch conformance ratchet requires it wherever single-record writes are granted. A batch admits only granted child verbs, so a batched delete is still refused; this is pinned in sys-unit.object.test.ts.
  • Locale fill. Only zh-CN carries translated sys_unit strings. The other nine locales carry the generator's English fill (nav labels are translated in all eleven).
  • Un-retire is refused. This is a rule, not a grant, so an organization that retires a code by mistake cannot bring it back; it names a new code. This is the open question to the seat.

Verification

All readings below are on head 298bbb987.

Derived gate families (110) and the --ran reconciliation
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 110 families from the tree at 298bbb987. Each family was run, and the exit code was captured before any pipe: 110 exited 0, none exited non-zero. This includes check:dual-build-cjs-loads (124 entry points across 72 packages load) and check:i18n-coverage ("14 config(s), 423 baselined untranslated string(s), none new").
  • --ran printed: "Run reconciliation — 110 derived, 110 run, 0 NOT-MEASURED, 0 UNRUN."
Overlap check
Not measured locally
  • check:dev-prereqs (a local-only family) exits 1 with "The workspace is not built — 1 unmet precondition": 35 of 108 workspace packages, all in the UI tree, have no dist/. This is the container's build state, not this diff. It is recorded as NOT MEASURED.
  • The CLI integration layer, test:repo, and the repo-wide lint are left to CI.
  • Dogfood: n/a. The title has no !, and Clause-② is a widening.

Generated by Claude Code

…e and the organization unit object sys_unit

ADR-0158 U1, U2 and U3. The spec gains STANDARD_UNITS, a closed table of
UN/ECE Recommendation 20 codes with each code's dimension and its exact
decimal-string ratio to the dimension's base unit (package codes carry no
ratio; the piece is H87, C62 and EA are not members), and the organization
code namespace pattern. platform-objects gains sys_unit: organization-owned,
zero shipped rows, code in the namespace and unique per organization, code and
dimension immutable, a ratio on every dimension but package, retiring in place
of a hard delete. member_default reads it; organization admins write it.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
…rd; spec surface regenerated; changeset

Open item 1: the standard table's 41 codes, seven dimensions, base units,
exact ratios and their sources. Open item 2: sys_unit is owned by
platform-objects, its field list, and its grants (members read, organization
administrators write). Open item 11: a deleted code stays retired, spelled as a
one-way retired flag that keeps the organization-scoped unique key held.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
…and field-attached rules with their pins

Regenerates the object translation bundles for sys_unit, hand-translates its
zh-CN strings, and attaches the code, dimension and retirement rules to the
field each guards. The real-stack suite pins member read, administrator write,
the namespace and immutability refusals and the retired code holding its key.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
…n reach

Regenerated with node scripts/platform-object-tenancy-census.mjs --write.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
… creates and updates are served and a batched delete stays refused

The apiMethods conformance ratchet requires bulk wherever single-record writes
are granted; bulk admits only a granted child verb, so delete stays closed.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:data protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/cli, @objectstack/platform-objects, @objectstack/plugin-security, @objectstack/spec, touching 98 documentable anchor(s). ⚠️ 4 changed file(s) yielded no anchor (packages/platform-objects/src/system/index.ts, packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

59 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json f981dce3be9b165502fb047954293b0de26ab97c.

⛔ 18 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 4 changed file(s) yielded no anchor (packages/platform-objects/src/system/index.ts, packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, …) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: isSystem (5 routes)
  • 15 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 187 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json f981dce3be9b165502fb047954293b0de26ab97c → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 67d898b2c7a036c7afdf20f584cfc3efdcd6467b — the merge of head 8037977d2bf6fdcf0cafc43e1f3012d3de64c21d into base f981dce3be9b165502fb047954293b0de26ab97c, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 67d898b2c7a036c7afdf20f584cfc3efdcd6467b && git checkout 67d898b2c7a036c7afdf20f584cfc3efdcd6467b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f981dce3be9b165502fb047954293b0de26ab97c 8037977d2bf6fdcf0cafc43e1f3012d3de64c21d && git checkout -B drift-repro f981dce3be9b165502fb047954293b0de26ab97c && git merge --no-ff 8037977d2bf6fdcf0cafc43e1f3012d3de64c21d

node scripts/docs-audit/affected-docs.mjs --json f981dce3be9b165502fb047954293b0de26ab97c

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f981dce3be9b165502fb047954293b0de26ab97c → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

Final head for review · area data-2 · 2026-11-19T16:14Z
Head: 298bbb98760424a465e87e338345de531b666c5b = dev head; K = 12 (under 15, no main merge). CI on the head is running.
Fixes #35488 · Refs #35465 (OI2), #35466 (OI11) · Clause-②: yes (widening) · Metadata-protocol: none · +2450/−9 over 53 files.
Gates: os-dev-report 7014806242 — dispatch-gates 110 derived, 110 run, 110 exit 0; overlap-check clean against origin/main and PRs #35510, #34223. No narrowing arm, so no dogfood battery.
PM body edit: attribution header; 维护者速读 line 4 now asks nothing of the maintainer (the OI11 retire reading is the seat's to rule); signed trailer.
Governed: docs/adr/** (ADR-0158 amended: OI1, OI2, OI11) → landing tier H (maintainer hand or an authorized APPROVED review, then the owning seat lands).
For the seat at contract review — two readings the dev raised, PM leaning A on both:

  1. L1 "delete allowed" / OI2 "delete: org admin" spelled as a one-way retired flag (no data-API or Setup delete; un-retire refused; re-creating a retired code refused 409). A: accept. B: allow un-retire by an org admin. C: physical delete plus another OI11 mechanism.
  2. An engine-level delete below the REST door is not refused. A: leave it to the membership card (OI9), which owns the write path. B: a separate small card for a beforeDelete refusal.
    Review route: L1-a, then seat 5's CONTRACT_REVIEW_TIER review; Tier H landing through the seat.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:平台内置一张标准计量单位表(千克、米、件、箱等 41 个国际通用代码),设置里新增"计量单位"页,组织管理员可添加本组织自己的单位;暂时还没有字段使用它们。
  • 为什么做:这是计量单位方案的第一步,先把标准单位和组织单位的底表定下来,后续的数量字段、写入校验和显示都读这两张表。
  • 出错会怎样:目前没有任何功能读取这些表,出错只影响新设置页本身;单位一旦停用不能恢复、代码不能重用,防止旧数据被换了含义。
  • 要你做什么:改了架构决策记录,属于需人工合并的一类:合同复审后需要你本人或授权审批人批准,再由席位落地。
  • 席位意见:单位表和对象做得严谨,权限和规则在真实环境验证过,可以进入合同复审;两处开放判断我同意区域的 A 方案。

席位核对

L1-a: ACCEPT, with one item before the L2 · head 298bbb98760424a465e87e338345de531b666c5b · Fixes #35488 · 2026-11-19T16:17Z · reviewed to pm-dispatch text at origin/main fca72dfa32

Readings, my own:

  • The claim is 7010577714, 13:30Z. It predates both the 14:38Z p1-only rule and the 15:24Z data hand-off, so this in-flight card is in scope.
  • check-governed-merges --pr 35581: GOVERNED, 1 of 53 paths (docs/adr/0158-…). Landing tier H. The low-risk skills arm does not apply: non-skills paths, a non-note ADR edit, a yes arm. +2450/−9 is under the human-merge threshold.
  • merge-tree against main is clean. K=12, so no merge is owed.

R1 (before the L2): CI green on this head. At this reading, 15 success, 12 skipped and 24 still in_progress: Test Core 1–10, the type checks, Check Changeset and the lint lanes. The record holds for this head once they finish green. A red needs a fix push and a fresh L1.

File surface. Every path is inside the claim: the spec constant and its export, platform-object-names.ts, the object, its registration, the member grant, the Setup entry, the regenerated translation and source-hash files, the CLI inventory, tests, .changeset/ and the ADR-0158 amendment. Three regenerated companions are not named in the claim word for word: api-surface/data.json, export-origins/data.json and scripts/platform-object-tenancy-census.json. The PR body names all three as regenerated. i18n-extract.config.ts adds only SysUnit to the extractor list, which is part of registration. No amendment is owed.

The spec table (standard-units.ts). I counted 41 codes:

Dimension Codes
mass 6
length 7
area 4
volume 4
time 5
count 3
package 12
  • Each base code has ratio '1'.
  • Every ratio is a decimal string. I checked the exact ONZ (0.028349523125 = 0.45359237/16) and GLL (0.003785411784 = 231 × 0.0254³).
  • ORGANIZATION_UNIT_CODE_PATTERN admits 4–32 characters, or 2–3 containing _. Every Rec 20 or Rec 21 code is 2–3 characters with no _, so no standard code can match. Pinned both ways.
  • ValueDomainSchema keeps its three members.

The object (sys_unit.object.ts).

  • The six rules are server-enforced validations. I read rule-validator.ts: record is the merged { ...previous, ...patch } on update, so the update-only immutability and one-way retired rules, and the insert+update ratio-shape rules, do not refuse a label-only PATCH. The real-stack cell creates a unit, relabels it and edits its ratio shows it.
  • Uniqueness is code unique per organization, and there is no tenancy opt-out, so organization_id is injected. The census reads reach in.
  • apiMethods has no delete, and bulk batches only granted verbs. userActions.delete: false.
  • Grants: member_default is read-only, with no row policy (the tenant wall confines it). external_default gets nothing. Writes go through organization_admin's wildcard.

Pins (names grepped). default-permission-sets.unit-of-measure.integration.test.ts runs on a real stack:

  • member: read, no create, no edit (403);
  • admin and owner: create, relabel, ratio edit;
  • namespace refusals, code/dimension change refused, ratio shape, each 400 VALIDATION_FAILED on the field;
  • retire, refuse un-retire, refuse re-creating the code.

sys-unit.object.test.ts and standard-units.test.ts pin the declaration and the table cell by cell. Nit, non-blocking: "refuses a delete either way" is pinned at declaration level (apiMethods), not by a real-stack DELETE / batched delete. One real-stack cell would close it; this could go in this PR or on the membership card.

Declaration: agreed. Clause-②: yes (widening): new exports and a new object, with no existing input refused. Metadata-protocol: none, with no field key (U8 ships with #35489). Skills-docs is not required for this arm. Changeset sentences checked against the diff:

  • the 41 codes, seven dimensions, base codes and ratio direction;
  • C62 / EA not members;
  • the namespace sentence;
  • PLATFORM_OBJECTS_BY_PACKAGE gains sys_unit;
  • the six columns and their rules;
  • "the data API serves no delete";
  • member read only and admin write;
  • the CLI inventory line.

The ADR-0158 notes (OI1 table, OI2 owner/fields/grants, OI11 retire) match the code. The OI11 note states the engine-level delete gap itself.

The two open readings (the seat rules).

  1. Retire-as-delete: I agree with A. It is the only spelling that keeps the code's unique key held, which is what OI11's hazard needs.
  2. The engine-level delete below the door: I agree with A. The membership card (OI9) owns the write path, and the ADR note already records that this path is not closed here.

Routing. L2 is owed at CONTRACT_REVIEW_TIER, for the governed ADR and the published packages/spec/src/**, by seat 5 on the green head. Then Tier H: the maintainer's hand or an authorized APPROVED review, then the seat lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:无新变化;只是一个测试里"设置菜单共有几项"的计数从 31 改为 32,因为本 PR 新增了"计量单位"菜单项。
  • 为什么做:上一版的持续集成里这个计数测试变红,原因就是新增的菜单项本身。
  • 出错会怎样:只改测试,不影响产品行为。
  • 要你做什么:无(合同复审后仍需你本人或授权审批人合并,同上一条记录)。
  • 席位意见:修正正确,CI 全绿后可进入合同复审;区域需补一条认领说明。

席位核对

L1-a delta: ACCEPT, with one required item and R1 still open · head c890bf191de13eadfe23a484bc8685ab7023d9cb (delta over 298bbb987, my record 7014935271) · 2026-11-19T16:41Z

Delta. One commit, one file: packages/cli/test/connect-agent-both-halves-wire.pin.test.ts, +7/−4.

The red on 298bbb987 (Test Core 1/10) was exactly this pin counting the new nav_units_of_measure entry, so the fix is the right one. A count bump without the presence assert would have hidden a swap; this PR has the assert.

R1 (from 7014935271, still open): CI green on this head. At this reading: 5 skipped, 18 in_progress, 2 queued. The record holds once they finish green. A red needs a fix push and a fresh delta L1.

R2 (new, required before queueing): amend the claim. packages/cli/test/connect-agent-both-halves-wire.pin.test.ts is not in the claim's file surface. The claim names the CLI inventory and "their tests", and this pin is not a test of the inventory. l1-review-checklist.md asks that a file beyond the claim be amended in the same round and named in the PR body with evidence. Post a claim amendment on #35488 naming the file and the reason (the new Setup entry moves the tree count). Add one line to the PR body citing the Test Core 1/10 red on 298bbb987. This is text only: no push and no fresh L1.

Unchanged. The declaration, the routing, and the two open readings for the seat are as in 7014935271: L2 at CONTRACT_REVIEW_TIER by seat 5 on the green head, then Tier H.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c890bf191de13eadfe23a484bc8685ab7023d9cb
Local-runs: probe — one read of the Recommendation 20 annex mirror that ADR-0158's Open item 1 note cites, compared with the table's 29 ratio codes and its three named exclusions; nothing from the PR's tree was built, run or re-run
Scope: packages/spec/src/data/index.ts, packages/spec/src/data/standard-units.ts, packages/spec/src/system/constants/platform-object-names.ts, docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md + packages/platform-objects/src/system/sys-unit.object.ts, packages/platform-objects/src/system/index.ts, packages/platform-objects/src/plugin.ts, packages/platform-objects/src/apps/setup-nav.contributions.ts, packages/plugins/plugin-security/src/objects/default-permission-sets.ts, packages/cli/src/utils/organization-ownership-inventory.ts
Security-touching: yes

PR #35581, card #35488, ADR-0158 U1 to U3. Read: the card's body and its three comments; the PR body, its 54 files (+2457/−13) and the net diff against main (merge base c0484c8fe7, main at e25ca63e95 for the cited code); the check-runs on the head. The ADR's notes cite ruling records on #35339, so those were read too: 7001193034, 7003532733 with its correction 7006481348, 7008524997 and 7008551416, and the bodies of the cards the notes answer or hand work to (#35465, #35466, #35467, #35489, #35498).

The security line reads yes because the diff teaches permission behaviour: a new read line on the member baseline, who creates, edits and retires a unit, and the tenant wall's reach. The PR is Tier H on its ADR path whatever that line says.

Two readings in this record are for the maintainer to confirm at approval. This review recommends on each and settles neither. They are under ③.

① Derived judgments

  1. Public surface of @objectstack/spec/data. Seven new names: the constants STANDARD_UNITS, UNIT_DIMENSIONS, UNIT_DIMENSION_BASE_CODES and ORGANIZATION_UNIT_CODE_PATTERN, and the types UnitDimension, RatioUnitDimension and StandardUnit. Nothing is removed or renamed. api-surface/data.json and export-origins/data.json each gain exactly these seven. Right.
  2. Platform name registry. PLATFORM_OBJECTS_BY_PACKAGE['platform-objects'] gains sys_unit, in alphabetical place, so PLATFORM_PROVIDED_OBJECT_NAMES holds it. The lint reference rules that read that set (isPlatformProvidedObjectName) now take a stack's reference to sys_unit as a real platform object and no longer as a prefixed name nobody registers. defineStack itself judges by prefix and is unchanged. That relaxes one advisory accept set. The spec lane lists the platform name registry among the non-protocol ride-alongs, so the protocol line stays none. Right.
  3. ValueDomainSchema. Unchanged, three members, as U1 rules. Right.
  4. No authorable key. No unit key on a field, and the liveness ledger and the authorable surface are untouched, as U8 rules. Spec property liveness is green. Right.
  5. @objectstack/platform-objects. One new object, sys_unit, in the first manifest beside sys_exchange_rate; ./system exports SysUnit and five constants. Right.
  6. Data API on sys_unit. get, list, create, update and bulk are served, with create and update as batch children. A delete is refused, single or batched. Right for the data API. The grant layer is wider than this door: reading 2.
  7. Grants. member_default gains a read-only line on sys_unit, the new line on the member baseline that the seat's first U3 note asks for. Organization administrators and owners write through the existing wildcard. external_default gains no line. Right as declared; see N3.
  8. Setup tree. One more entry under Configuration, 31 to 32. The pin moved in both places and gained a presence assert for nav_units_of_measure. main still pins 31, and its one later change to the Setup contributions file is comment-only, so the count holds on the merge. Right.
  9. Tenancy census and ownership inventory. 104 registered, 53 in reach, 51 out of reach; sys_unit reads in reach on organization_id. The CLI inventory lists it as attributed. Right.

② Semver level

  • The changeset bumps @objectstack/spec, @objectstack/platform-objects, @objectstack/plugin-security and @objectstack/cli at patch. Each of the four has a non-test source change in the diff.
  • Metadata-protocol: none is right. The diff adds no key, accepted value or metadata type that an author writes, and the level for none is patch.
  • The declaration Clause-②: yes (widening) is right. The diff adds public exports and relaxes one accept set, and refuses nothing that was accepted before. Both declaration lines stand line-initial in the PR body and in the changeset body.
  • Nothing is removed, so no ADR-0087 disposition is owed.
  • Check Changeset concluded success on both of its runs.

③ Boundary flags

Reading 1, the dev's first open question. For the maintainer to confirm at approval. L1 says "deleting an org unit is allowed" and Open item 2 asks who deletes. The PR spells that delete as a one-way retired flag: the row is never removed, un-retiring is refused, and the retired row keeps the organization-scoped unique key, so its code cannot be created again.

Recommendation: confirm it as shipped (the dev's option A). Reasons:

  • Open item 11 hands this card two choices, and "a deleted code stays retired" is the first of them, word for word. A row that stays on file is the one mechanism that keeps the unique key held without a second table.
  • L1's delete bullet is the owning seat's settlement, not the maintainer's words (correction 7006481348). Its effects survive: resting rows keep their code and stored conversion, and the refusal of a new save with that code is the membership card's, which now has a flag to read.
  • Strict first is the order that can be undone. Dropping the one-way rule later is a widening that needs no migration. Adding it later would be a narrowing over rows already brought back.

Four things the maintainer should have in hand when confirming:

  • The refusal of un-retire is a product choice. Open item 11 does not require it. Its hazard is a code coming back with another dimension, ratio or label, and un-retiring brings back the same row, whose code and dimension cannot change and whose ratio and label can be edited at any time anyway.
  • Its cost is that a mistaken retire is permanent. Retiring is an ordinary field edit on the unit's form, and this diff declares no dedicated action or confirmation step for it. With the code and the dimension immutable as well, a code retired or created by mistake is spent for good, and the organization names a new one.
  • One sentence of L1 changes meaning. A deleted unit "shows the code without a label"; a retired unit keeps its label on file. The ADR note hands that choice to the display card (Units of measure R1: show a quantity with its unit label #35490).
  • The reading only holds if the membership check reads the flag. The Open item 9 settlement on Units of measure: decide which writes the unit membership check judges (ADR-0158 Open item 9) #35467 (7013996288, another seat, written before this PR reported) admits "a code in the organization's sys_unit rows" and speaks of a unit "deleted under L1" as no longer a member. A retired row is still a row. Unless Units of measure R1: a number field declares its unit (unitConfig) and the write path checks the unit code #35489 treats a retired row as a non-member, a retired code stays usable on new saves and L1's refusal does not hold. The ADR note at this head says the membership card refuses it; the card itself does not say so yet.

Reading 2, the dev's second open question. For the maintainer to confirm at approval. enable.apiMethods closes the data API and Setup offers no Delete, but nothing refuses a delete issued to the engine below that door. The ADR's Open item 11 note records the gap and says that whether an automation could issue one was not measured.

By reading the tree at this head, that unmeasured half has an answer: yes. A path that an organization administrator can author reaches an engine delete on sys_unit, and the grant layer does not refuse it there. The only refusal at this head is the exposure gate, which the runtime's own header describes as a surface-area control and not the authorization boundary. The path is named to the seat outside this record.

Recommendation: confirm the deferral to the membership card (the dev's option A), on one condition. Reasons:

The condition: the carry is written down before this lands, as two lines on #35489: an engine-side refusal of a delete on sys_unit, and a retired row read as a non-member (reading 1). As read today, neither #35489's body nor #35467 names either, and the ADR note names the gap but no card for it (N2). Without those lines the deferral has no owner. The dev's option B, a separate small card, is equally sound if the seat prefers to keep #35489 narrow. What is not sound is neither.

The same card should take L1-a's note with it: a real-stack cell for a refused delete.

The dev's other flags.

  • The dimension is named count, where the dispatch brief said "piece". Accepted. The ruled text names no dimension; U2 fixes only the code H87. count with PR 2 and DZN 12 is sound, and the ADR note gives the reason.
  • bulk is granted. Accepted. A batch admits only a granted child verb, so a batched delete stays refused; the declaration pin holds it.
  • Commit trailers. The model-free pair AGENTS.md prescribes. No contract effect.
  • WIP commits pushed before the first overlap check. A process note for the PM; the later check read clean. No contract effect.
  • Out-of-scope note: os lint reports translation-target-unknown on Setup nav entries. It predates this diff, as nav_exchange_rates shows. It is the lane seat's to file under Prime Directive 10 if it reproduces. No effect on this record.
  • Locale fill. Generated output, the lane seat's.

L1-a's two items. R1, green CI on this head: confirmed below. R2, the claim amendment for the pin file: posted (7015603132), and the PR body names the file with its evidence.

CI on the head. 74 check-runs on c890bf191, all completed, the last at 2026-11-19T17:09:48Z: 61 success, 13 skipped, none red, none pending. Of the eleven required contexts, ten concluded success: Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard, Type Check UI, Test UI, Build & E2E UI, Live E2E UI and Dogfood Regression Gate. Lint UI concluded skipped; the file list holds no path under ui/. It is named here for the landing seat.

SQL push-down. The diff builds no query, materialises no ids and joins nothing in the app. Nothing to flag.

For the lane seat's ACCEPT, outside ④. Tenant isolation is pinned as the declaration the wall reads, and as the stamped organization_id on a real stack. No cell runs two organizations holding the same code.

④ Design judgment

No must-fix, no should-fix.

packages/spec/src/data/standard-units.ts, against U1, U2 and U3.

  • Closed constant, separate from the value domains, in the form of CURRENCY_FRACTION_DIGITS. Schemas and constants only, no logic. Holds.
  • 41 codes: mass 6, length 7, area 4, volume 4, time 5, count 3, package 12. All 29 ratio codes were compared with the annex mirror the ADR cites: each is an active code, and each name and factor agrees. ONZ and GLL are printed rounded there, as the docblock says; the exact values check by arithmetic (0.45359237 / 16 = 0.028349523125, and 231 × 0.0254³ = 0.003785411784), both within 12 places. FTK is 0.3048² = 0.09290304.
  • The three exclusions hold as stated. HAR carries the deprecated status in that source. MON and ANN carry factors that rest on a 365.25-day year.
  • The twelve package codes carry their Recommendation 21 names. That half was checked against what this reviewer knows of the list, not against the Peppol file the note cites; the mirror read holds no X codes.
  • U2 holds: H87 is the piece and the base of count; C62 and EA are absent, and both are refused as organization codes by the namespace.
  • ORGANIZATION_UNIT_CODE_PATTERN was read branch by branch. It admits 4 to 32 characters of uppercase letters, digits and underscores starting with a letter or digit, and the 2 and 3 character forms that contain an underscore. Every standard code is 2 or 3 letters or digits with no underscore, so none can match, now or later. U3's sentence holds.
  • For what the ADR names, the table is complete: H87, XBX, XPX and KGM are members. Which further codes a curated subset holds is this card's to settle, and the note says the table widens only by amendment. SET and CMQ are common on order lines and absent; that is noted, not a finding.
  • The ratios are strings here and sys_unit.ratio is a number column, the shape sys_exchange_rate.rate has. Reconciling the two is the R2 card's, under Open item 4.

packages/spec/src/data/index.ts. One export * line with its ADR id. Holds.

packages/spec/src/system/constants/platform-object-names.ts. One name, in the owning package's group; the package's conformance test moved with it. Holds.

docs/adr/0158-…md, the three notes against the code.

packages/platform-objects/src/system/sys-unit.object.ts.

  • Organization-owned: no tenancy opt-out, so organization_id is injected and the tenant wall scopes it, like sys_exchange_rate. The unique key on code is spelled 'organization'. Zero rows ship. U3 holds.
  • Labels say "Unit of Measure" throughout, the seat's second U3 note.
  • The six rules were read against the rule validator. A predicate sees the merged record, and previous is bound per row on a multi-row update as well, so the immutability rules and the one-way rule cannot be slipped by a batched or filtered update, and a label-only edit is not refused.
  • L1: the ratio is editable, every authored column carries field history, and the ratio's description carries the sentence that an edit affects only records saved afterwards.
  • A retired unit stays editable: label, ratio and decimal places. That agrees with L1.

default-permission-sets.ts. member_default gains a read bit on sys_unit and no write bit; the comment gives the reason for no row policy. Agrees with the seat's U3 note.

plugin.ts, system/index.ts, setup-nav.contributions.ts, organization-ownership-inventory.ts. Registration in the first manifest, the exports, the Setup entry under Configuration after Exchange Rates with no extra permission gate, and the attribution row. Each agrees with the Open item 2 note.

Nits. None moves the head. The three on the ADR's prose face can ride the amendment that records the maintainer's confirmation of the readings; the rest are follow-ups.

  • N1 (nit, ADR prose face): L1's own section still reads "deleting an org unit is allowed" and "it does not hold across a delete and a new create of the same code", and the Consequences bullet on a deleted unit's rows still reads "show the code without a label". Neither carries a dated note pointing at Open item 11's settlement, as the bullet above it does. A reader of L1 alone still reads a physical delete.
  • N2 (nit, ADR prose face): the Open item 11 note names the door it leaves open but no card that closes it, and says an automation was not measured. It should name the carrier once reading 2 is confirmed, and can then state the answer.
  • N3 (nit, ADR prose face): "every member reads" is the member baseline. An external member resolves external_default, which has no sys_unit line, so an external reader of a quantity gets no label for an organization's unit. The seat's note says the label should display "to everyone who reads the quantity". A grant on the external baseline is a ruling's to make; the display card (Units of measure R1: show a quantity with its unit label #35490) should carry the question.
  • N4 (nit, follow-up on Units of measure R1: a number field declares its unit (unitConfig) and the write path checks the unit code #35489): the table is a plain object typed as a string-keyed record of StandardUnit, frozen one level deep, and the spec exports no lookup for it. The first reader should ask membership through one exported own-property lookup, so an inherited name never reads as a member. It mirrors CURRENCY_FRACTION_DIGITS, whose membership read does live in the spec.
  • N5 (nit, follow-up): no scripts/adr-anchors/ entry marks the spots Open item 11 rests on (the apiMethods list, the one-way rule, the unique key). The pins hold them today; Prime Directive 13 asks for the anchor.
  • N6 (nit, follow-up for Open item 1): an organization's unit needs one of the seven dimensions, and every one but package needs a ratio to a platform base. A unit outside the seven, a kilowatt hour for example, has no honest dimension. With the dimension immutable and a code never reusable, a wrong first choice is permanent. The maintainer may want this beside reading 1.

Implemented-by: claude/issue-35488-unit-tables
Reviewed-by: isolated-l2-35581

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8037977d2bf6fdcf0cafc43e1f3012d3de64c21d
Local-runs: none
Scope: packages/spec/src/data/index.ts, packages/spec/src/data/standard-units.ts, packages/spec/src/system/constants/platform-object-names.ts, docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md + packages/platform-objects/src/system/sys-unit.object.ts, packages/platform-objects/src/system/index.ts, packages/platform-objects/src/plugin.ts, packages/platform-objects/src/apps/setup-nav.contributions.ts, packages/plugins/plugin-security/src/objects/default-permission-sets.ts, packages/cli/src/utils/organization-ownership-inventory.ts
Security-touching: yes

Delta review d1, merge-only, on PR #35581 (card #35488). It reads from c890bf191de13eadfe23a484bc8685ab7023d9cb, the head the record in comment 7016785755 judged, to this head. The one new commit is a merge of main. Everything that record says about the PR's own change stands on this head, its six nits and its two readings included. Read for this round: the merge commit against both parents, the card and PR threads since that record (no new comment but the record itself), and the check-runs on this head.

The two readings of that record are still for the maintainer to confirm at approval. The merge changes neither, and this round settles neither.

① Derived judgments

  • The PR's own change is byte-identical. The diff from the second parent to this head has the same stable patch id as the diff from the old merge base to the old head: 54 files, +2457/−13, the same 54 paths. The nine derived judgments of the first record stand unchanged.
  • Setup tree count. The pin file is byte-identical to the old head: both counts read 32, with the presence assert for nav_units_of_measure. main pins 31 at the second parent and at its tip. Between the old base and the second parent, and from there to main's tip, main adds and removes no Setup navigation entry. So 32 is still main's 31 plus this PR's one entry.
  • Generated files. No generated file of this PR changed on main's side: the only path both sides changed is the hand-written setup-nav.contributions.ts. api-surface, export-origins, the tenancy census and the translation bundles are byte-identical to the old head.

② Semver level

The changeset file and both declaration lines are unchanged. Check Changeset concluded success on this head. Nothing to add to the first record.

③ Boundary flags

  • Open flags. None new. The two readings and the carry they need on Units of measure R1: a number field declares its unit (unitConfig) and the write path checks the unit code #35489 are as the first record states them.
  • CI on this head. 70 check-runs, all completed: 59 success, 11 skipped, none red, none pending. Of the eleven required contexts, ten concluded success: Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard, Type Check UI, Test UI, Build & E2E UI, Live E2E UI and Dogfood Regression Gate. Lint UI concluded skipped, as on the old head. It is named here for the landing seat.
  • main has moved again. The second parent is three commits behind main's tip at this read. Those three commits touch none of this PR's 54 paths, and a recomputed merge of this head with that tip reports no conflict.
  • SQL push-down. A merge commit; no query is built. Nothing to flag.

④ Design judgment

No must-fix, no should-fix.

  • Parents. The first parent is c890bf191de13eadfe23a484bc8685ab7023d9cb, the reviewed head. The second is f981dce3be9b165502fb047954293b0de26ab97c, a commit on main's first-parent line.
  • No hand resolution. This head's tree equals the tree a mechanical merge of the two parents produces, and the merge commit's combined diff is empty. No path carries a conflict hunk.
  • One path changed on both sides: packages/platform-objects/src/apps/setup-nav.contributions.ts, an implementing file of this review. main's side is one comment-only hunk about the Packages door, the same change the first record already read on main. This PR's side is the nav_units_of_measure entry, some ninety lines below it. The two hunks do not touch, and the merged file holds each as its side wrote it.
  • Every other reviewed file is byte-identical to the old head: the four hits files (the ADR among them) and the other five implementing files.
  • Cited code outside the diff. main moved two files the first round read, the rule validator and the security plugin's authorization middleware. Both changes are about which locale a refusal's label is written in. Rule evaluation, the per-row binding of the prior record and the write guard are untouched, so the first record's reading of the six sys_unit rules holds. The files read for reading 2 are byte-identical, so its answer holds too.

Nits. N1 to N6 of the first record stand as written. The merge touches none of them, and this round adds none.

Implemented-by: claude/issue-35488-unit-tables
Reviewed-by: isolated-l2-35581

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

维护者速读

席位核对 — ACCEPT · repo:objectstack#5 · head 8037977d2bf6fdcf0cafc43e1f3012d3de64c21d · 2026-11-19T18:16Z

  • Shape: 54 files, +2457/−13 (under 3000): STANDARD_UNITS in spec, the sys_unit object (organization-scoped, unique per organization, ships with no rows), Setup nav entry (count pin 31→32), ADR-0158 notes for Open items 1, 2 and 11. Fixes #35488, Refs #35465, Refs #35466, Clause-②: yes (widening), Metadata-protocol: none. L1-a ACCEPT 7014935271, delta 7015590319 (data-2).
  • Contract review: PASS 7016785755 at c890bf19 (no must-fix, no should-fix, nits N1–N6, two readings for the maintainer), then merge-only delta d1 PASS 7017917809 at this head (no conflict resolution; the PR's own patch is unchanged).
  • Gates: every check-run on this head finished: 59 success, 11 skipped, 0 failed. Lint UI is skipped (no ui/ path).
  • Accepted deviations: nits N1–N3 (ADR prose) ride the ADR amendment that records the maintainer's confirmation of the readings; N4 and the reading-2 carry are on Units of measure R1: a number field declares its unit (unitConfig) and the write path checks the unit code #35489 (7016814814); N5 and N6 are follow-ups.
  • Landing clause: Tier H (docs/adr/**). K = 4 first-parent commits on main since the merge's main parent (< 15). This stroke: ready for review, reviewers os-zhuang, hotlong; pm:awaiting-merge. A human merge is the review record and confirms readings 1 and 2.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 18:17
@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 19, 2026
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 7411f9b Nov 19, 2026
76 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-35488-unit-tables branch November 19, 2026 22:28
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data protocol:system size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Units of measure R1: the standard unit table in the spec and the organization unit object sys_unit

3 participants